package sdfi.lee.Entity;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import sdfi.lee.DAO.LabDAO;
import sdfi.lee.Entity.base.BaseLab;



public class Lab extends BaseLab {
	private static final long serialVersionUID = 1L;
	private String ppath=null;

public String getPpath() {
		if(this.getLabdescribe()!=null&&this.getLabdescribe().length()>0)
		{
			this.setPa(this.getLabdescribe());
		}
		return ppath;
	}
	public void setPa(String source)
	{
		try
		{
			this.setPpath("");
			String regex="/userfiles.+[jpg][gif]";
			Pattern p=Pattern.compile(regex);
			Matcher mp=p.matcher(source);
			if(mp.find())
				this.setPpath(mp.group().replace("/project", ""));
			
		}
		catch(Exception ee)
		{
			ee.printStackTrace();
		}
	}
	public void setPpath(String ppath) {
		this.ppath = ppath;
	}

	/*[CONSTRUCTOR MARKER BEGIN]*/
	public Lab () {
		super();
	}

	/**
	 * Constructor for primary key
	 */
	public Lab (java.lang.Integer id) {
		super(id);
	}
	public Lab(Integer id,String labname)
	{
		this.setId(id);
		this.setLabname(labname);
	}
	public String execute()
	{
	
		return new LabDAO().labAdd(this);
	}

/*[CONSTRUCTOR MARKER END]*/


}